package com.hehan.hhdemo.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.hehan.hhdemo.common.resp.ModelResp;
import com.hehan.hhdemo.mapper.ModelMapper;
import com.hehan.hhdemo.po.Model;
import com.hehan.hhdemo.service.IModelService;
import com.hehan.hhdemo.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * Created by hehan on 2018/11/2.
 */
@Service
public class ModelServiceImpl implements IModelService {

    @Autowired
    private ModelMapper modelMapper;

    @Override
    public List<ModelResp> queryList() {
        List<Model> models = modelMapper.selectAll();
        List<ModelResp> lists= Lists.newArrayList();
        if(models !=null){
            for (Model model : models) {
                ModelResp modelResp=new ModelResp();
                modelResp.setId(model.getId());
                modelResp.setName(model.getName());
                modelResp.setSkuId(model.getSkuId());
                lists.add(modelResp);

            }
        }

        return lists;
    }
}
